package com.hubu.springcloudcconsumer8003.Controller;

import com.hubu.pojo.IdCart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/idcart")
public class IdCartController {
    @Autowired
    private RestTemplate restTemplate;
    private static final String REST_URL_PREFIX = "http://SPRINGCLOUD-PROVIDER-IDCART";

    @GetMapping("getOne")
    public IdCart getOne(String id){
        return restTemplate.getForObject(REST_URL_PREFIX+"/idcart/getOne?id="+id,IdCart.class);
    }
}
